﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using Senparc.Weixin.MP.AdvancedAPIs.OAuth;
using TrainingReminderSystem.Bll;
using TrainingReminderSystem.Model;
using Extentions;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Senparc.Weixin.MP.Helpers;

namespace TrainingReminderSystem.ApiControllers
{
    /// <summary>
    /// 获取AccessToken
    /// </summary>
    public class AccessTokenInfoController : BaseControllerBase
    {
        /// <summary>
        /// 提交帐号密码,获取AccessToken
        /// </summary>
        /// <param name="model"></param>
        /// <returns>返回的AccessToken如果有效期超过一半,则会变成新的AccessToken值</returns>
        [AllowAnonymous]
        [HttpPost]
        [Route("api/AccessTokenInfo/GetToken")]
        public AjaxResult<SysAccessTokenInfoBll.AccessTokenModel> GetToken(SysAccessTokenInfoBll.TokenModelSubmit model)
        {
            return new SysAccessTokenInfoBll().GetTokenModel(model);
        }
    }
}
